FROM node:18 as node_builder

WORKDIR /app

# 复制 package.json 和 package-lock.json
COPY . /app
RUN npm install \
            &&  npm install --save-dev laravel-echo pusher-js 
RUN echo "Building frontend files..." \
&& npm run build \
&& ls -la /app


FROM shinsenter/frankenphp:latest

LABEL authors="Administrator"


# Install imagick, swoole and xdebug
RUN phpaddmod imagick swoole xdebug


WORKDIR  /app


COPY . /app
COPY --from=node_builder /app/package-lock.json /app/package-lock.json
COPY --from=node_builder /app/package.json /app/package.json
COPY --from=node_builder /app/public /app/public
#COPY . /app
## 验证文件是否复制成功
#
#
#RUN ls  \
#    && composer install \
#    &&  php artisan octane:install --server=frankenphp \

#ENTRYPOINT ["php", "artisan", "octane:frankenphp"]






# ENTRYPOINT ["/bin/bash", "-c"]
# CMD ["php artisan octane:install --server=frankenphp && php artisan octane:frankenphp --max-requests=500"]
